import React, { Component } from 'react';
import {Popup} from 'antd-mobile'
import FooterAlertMaskList from './FooterAlertMaskList'
import style from './footerAlertMask.scss'

class FooterRegionAlertMask extends Component {
    constructor(props) {
        super(props);
		this.state = {
	        timesIndex: '',  //默认的选择
        };
    }

	cancel(){
		Popup.hide()	
	}

	onChoose(times,timesName){
		this.props.onChoose(times,timesName)
		this.setState({
			timesIndex: times
		})
	}

    render() {
        return (
            <div className={style.footerAlertBox}>
               <ul className={style.listType}>
					{
						this.props.data.map((item,index)=>{

						return <FooterAlertMaskList key={index}
													item={item}
													timesIndex={this.state.timesIndex||this.props.timesIndex}
													onChoose={(times,timesName)=>{this.onChoose(times,timesName)}}
							/>
						})
					}
               </ul>

                <div style={{height: '.38rem',background: '#f1f1f1'}}></div>
                <div className={style.btn} onClick={()=>{this.cancel()}}>取消</div>
            </div>
        )
    }
}

export default FooterRegionAlertMask